package com.ruoyi.tongyan.service.impl;

import java.util.List;

import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.tongyan.mapper.TAchievementOutputMapper;
import com.ruoyi.tongyan.domain.TAchievementOutput;
import com.ruoyi.tongyan.service.ITAchievementOutputService;

/**
 * 科研成果主Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-04-20
 */
@Service
public class TAchievementOutputServiceImpl implements ITAchievementOutputService 
{
    @Autowired
    private TAchievementOutputMapper tAchievementOutputMapper;

    /**
     * 查询科研成果主
     * 
     * @param achievementId 科研成果主主键
     * @return 科研成果主
     */
    @Override
    public TAchievementOutput selectTAchievementOutputByAchievementId(Long achievementId)
    {
        return tAchievementOutputMapper.selectTAchievementOutputByAchievementId(achievementId);
    }

    /**
     * 查询科研成果主列表
     * 
     * @param tAchievementOutput 科研成果主
     * @return 科研成果主
     */
    @Override
    public List<TAchievementOutput> selectTAchievementOutputList(TAchievementOutput tAchievementOutput)
    {
        return tAchievementOutputMapper.selectTAchievementOutputList(tAchievementOutput);
    }

    /**
     * 新增科研成果主
     * 
     * @param tAchievementOutput 科研成果主
     * @return 结果
     */
    @Override
    public int insertTAchievementOutput(TAchievementOutput tAchievementOutput)
    {

// 获取当前登录用户ID
        Long userId = SecurityUtils.getUserId();
        tAchievementOutput.setCreatedBy(userId);
        return tAchievementOutputMapper.insertTAchievementOutput(tAchievementOutput);
    }

    /**
     * 修改科研成果主
     * 
     * @param tAchievementOutput 科研成果主
     * @return 结果
     */
    @Override
    public int updateTAchievementOutput(TAchievementOutput tAchievementOutput)
    {
        return tAchievementOutputMapper.updateTAchievementOutput(tAchievementOutput);
    }

    /**
     * 批量删除科研成果主
     * 
     * @param achievementIds 需要删除的科研成果主主键
     * @return 结果
     */
    @Override
    public int deleteTAchievementOutputByAchievementIds(Long[] achievementIds)
    {
        return tAchievementOutputMapper.deleteTAchievementOutputByAchievementIds(achievementIds);
    }

    /**
     * 删除科研成果主信息
     * 
     * @param achievementId 科研成果主主键
     * @return 结果
     */
    @Override
    public int deleteTAchievementOutputByAchievementId(Long achievementId)
    {
        return tAchievementOutputMapper.deleteTAchievementOutputByAchievementId(achievementId);
    }
}
